package com.fly.db.entity;

import com.fly.db.exception.TableColumnExistException;

import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

/**
 * Created with Android Studio.
 * Package_Name：com.fly.db.entity
 * Project_Name：DBExample
 * User：郭鹏飞
 * Date：2016/1/26
 * Email：love518420@foxmail.com
 * Description：
 */
public class Table {
    private String tableName;
    private LinkedHashMap<String, String> columns;

    public Table(String tableName) {
        this.tableName = tableName;

        columns = new LinkedHashMap<>();
    }

    public String getTableName() {
        return tableName;
    }

    public Map<String, String> getColumns() {
        return columns;
    }

    public void put(String columnName, String columnPropety) {
        if (columns.containsKey(columnName)) {
            throw new TableColumnExistException();
        }
        columns.put(columnName, columnPropety);
    }
}
